#ifndef TOKENIZER_HPP
#define TOKENIZER_HPP
#include <string>
#include <queue>
#include <map>
#include <iostream>

enum TokenState { 
	FREE 	= 1,
	SET	= 2,
	NOSET	= 4
};

enum TokenModifier {
	NONE 		= 1,
	STAR		= 2,
	PLUS		= 4,
	QUESTION_MARK	= 8,
	START		= 16,
	END		= 32
};

struct Token {
	char 		Valid;
	TokenState 	State;
	TokenModifier 	Modifier;
};

class Tokenizer {
// Ctor && Dtor
	public:
		Tokenizer(const std::string& inputString);
		Tokenizer(const Tokenizer& cpyTokenizer);

// Operateurs
	public:
		Tokenizer 	operator =(const Tokenizer& cpyTokenizer);

// Méthodes publiques
	public:
		bool isAtBegin() 	const;
		bool isAtEnd() 		const;
		void buildTokenQueue();
	
		Token getNextToken();
	
// Constructeur privé
	private:
		Tokenizer();
		void buildMaps();

// Membres privés
	private:
		std::map<char,TokenState> charStates;
		std::map<char,TokenModifier> charModifiers;
		std::queue<Token> tokens_;
		std::string 			inputString_;
		std::string::const_iterator 	seekPointer_;
};

inline std::ostream& operator<<(std::ostream& os,Token tok)
{
	os << "{Modifier : "; 
	os <<  tok.Modifier;
	os << " - ";
	os << "State : ";
	os << tok.State;
	os << " - ";
	os << "Valid : ";
	os << tok.Valid;
	os << "}"; 
	return os;
}
#endif // #ifndef TOKENIZER_HPP
